import groovy.jmx.builder.modelmbean.ModelMBeanConstructorCollector

class ModelMBeanConstructorCollectorTest extends GroovyTestCase {
    def dataGenerator
    def collector

    void setUp() {
        dataGenerator = new NodeDataGenerator()
        collector = new ModelMBeanConstructorCollector()
    }

    void testCollectConstructorInfoFromNodeData() {
        def treeNode = dataGenerator.generateMBeanNodeData()
        assert treeNode != null

        def info = collector.collectConstructorInfo(treeNode)
        assert info != null
        assert info.size() == 2
    }

    void testCollectConstructorInfoFromInstance() {
        def instance = new ExposedTestBean()
        def info = collector.collectConstructorInfo(instance)
        assert info != null
        assert info.size() == 3
    }

    void testCollectConstructorInfoJavaFromInstance() {
        def instance = new TestJavaBean()
        def info = collector.collectConstructorInfo(instance)
        assert info != null
        assert info.size() == 2
    }
}